<template>
  <div class="connect view">
    <div class="content">
      <div class="content-box">
        <div class="content-box-top">
          <div class="bg" />
          <div class="info flex">
            <div class="info-left">
              <div class="msg">欢迎来到一个无限可能的世界，旅程与目的地一样令人兴奋，每一刻都是在存在的画布上留下您的痕迹的机会。唯一的限制就是您的想象力的程度。</div>
              <div class="info-list">
                <div
                  class="info-list__item"
                  v-for="(item, index) in list"
                  :key="index">
                  <div class="info-list__item-label">{{ item.label }}：</div>
                  <div class="info-list__item-value">{{ item.value }}</div>
                </div>
              </div>
            </div>
            <div class="info-map" id="map-content" />
          </div>
        </div>
        <div class="form-box">
          <div class="form-box__left">
            <div class="flex">
              <div class="form-item">
                <div class="form-item__label">显示名称</div>
                <input v-model="params.name" type="text" placeholder="(required)">
              </div>
              <div class="form-item">
                <div class="form-item__label">电子邮箱地址</div>
                <input v-model="params.email" type="text" placeholder="(required)">
              </div>
            </div>
            <textarea
              v-model="params.message"
              placeholder="Message" />
            <div class="btn" @click="onSubmit">发送</div>
          </div>
          <div class="form-box__right">
            <div class="form-box__right-item">有问题、评论或请求？</div>
            <div class="form-box__right-item">请随时与我们联系，我们很乐意听取您的宝贵意见。</div>
          </div>
        </div>
      </div>
    </div>
    <div class="common-footer">
      <app-footer />
    </div>
  </div>
</template>

<script setup>
import { reactive } from 'vue'

const map = shallowRef()

onMounted(() => {
  map.value = new AMap.Map('map-content', {
    zoom: 10,
    center: [116.397428, 39.90923]
  });
  let marker = new AMap.Marker({
    title: '公司',
    position: [116.39, 39.9],
    // icon: '/images/common//2.png'
  })
  map.value.add(marker)
})
const list = [
  { label: '地址', value: 'C. de Preciados, 374 37201' },
  { label: '电话', value: '0123-456-7890' },
  { label: '电子邮箱', value: 'contact@yourgroovydomain.com' },
]

const params = reactive({
  name: '',
  email: '',
  message: ''
})

const onSubmit = () => {
  if (!params.name) return alert('请输入显示名称！')
  if (!params.email) return alert('请输入电子邮箱！')
  console.log(params)
}
</script>

<style lang="less" scoped>
.content {
  width: 100%;
  height: 11.03rem;
  background: linear-gradient(#EAE7E1 0%, #F6F5F2 100%);
  position: relative;

  .form-box {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: .52rem;

    .form-box__left  {
      width: 7.94rem;

      textarea {
        width: 7.94rem;
        display: block;
        height: 1.72rem;
        border-radius: 4px;
        border: 1px solid #C1B6A8;
        background: transparent;
        outline: none;
        padding: .12rem .22rem;

        &::-webkit-input-placeholder {
          color: #333333;
        }
      }

      .form-item {
        width: 3.89rem;
        height: .5rem;
        border-radius: .04rem;
        border: .01rem solid #C1B6A8;
        margin-bottom: .19rem;
        line-height: .5rem;
        padding: 0 .22rem;
        display: flex;

        &__label {
          font-size: .16rem;
          color: #333333;
          font-weight: 400;
          margin-right: .1rem;
        }

        input {
          border: none;
          background: transparent;
          flex: 1;
          outline: none;
        }

        &:first-child {
          margin-right: .16rem;
        }
      }

      .btn {
        height: .5rem;
        border-radius: 0.04rem;
        background: #C48674;
        color: #FFFFFF;
        text-align: center;
        line-height: .5rem;
        cursor: pointer;
        margin-top: .16rem;
        font-weight: 600;
        font-size: .16rem;
      }
    }

    .form-box__right {
      width: 2.7rem;
      height: .75rem;
      color: #333333;
      font-size: .14rem;
      font-weight: 400;
      line-height: .25rem;
    }
  }

  .content-box {
    position: absolute;
    left: 3.97rem;
    top: 1.78rem;

    .content-box-top {
      padding-bottom: .88rem;
      border-bottom: 1px dashed #CCBEB3;

      .info {
        height: 2.88rem;

        .info-map {
          width: 5.39rem;
          height: 2.88rem;
          border-radius: 0.04rem;
        }

        .info-left {
          height: 2.88rem;
          width: 5.65rem;
          display: flex;
          flex-direction: column;
          margin-right: .34rem;

          .msg {
            color: #333333;
            font-size: .14rem;
            font-weight: 400;
            width: 5.16rem;
            line-height: .25rem;
            padding-bottom: .18rem;
            //margin-bottom: .18rem;
          }

          .info-list {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;

            &__item {
              flex: 1;

              &-label {
                color: #7A625B;
                font-size: .25rem;
                font-weight: 600;
                //margin-bottom: .08rem;
              }

              &-value {
                color: #333333;
                font-size: .16rem;
                font-weight: 400;
              }
            }
          }
        }
      }

      .bg {
        width: 1.6rem;
        height: .41rem;
        margin-bottom: .24rem;
        background: url('/images/connect/service-process.png') no-repeat;
        background-size: 100% 100%;
      }
    }
  }
}
</style>
